<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>修改权限</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" charset="utf-8" src="/static/js/jquery-1.11.3.min.js"></script>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="/static/js/jstree/themes/default/style.min.css"/>
    <script src="/static/js/jstree/jstree.min.js"></script>
</head>
<body>
<div class="x-body">
    <form class="layui-form" id="dwedwdefefefewfewdewdew" onsubmit="return false;">
        <input type="hidden" name="parent" value="${model.parent!0}" id="parentId">
        <input type="hidden" name="id" value="${model.id!}">
        <div class="layui-form-item">
            <div class="layui-inline layui-col-md5">
                <label class="layui-form-label">权限名:</label>
                <div class="layui-input-inline">
                    <input type="text" name="funName" value="${model.funName!}" class="layui-input">
                </div>
            </div>
            <div class="layui-inline layui-col-md5">
                <label class="layui-form-label">权限值:</label>
                <div class="layui-input-inline">
                    <input type="text" name="funDescp" value="${model.funDescp!}" class="layui-input ">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline layui-col-md5">
                <label class="layui-form-label">路径:</label>
                <div class="layui-input-inline">
                    <input type="text" name="funPath" value="${model.funPath!}" class="layui-input">
                </div>
            </div>
            <div class="layui-inline layui-col-md5">
                <label class="layui-form-label">类型:</label>
                <div class="layui-input-inline">
                    <input type="radio" name="isMenu" value="0" lay-skin="primary" title="权限" <%if(model.isMenu! ==0 ){%>checked<%}%> >
                    <input type="radio" name="isMenu" value="1" lay-skin="primary" title="菜单" <%if(model.isMenu! ==1 ){%>checked<%}%> >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline layui-col-md5">
                <label class="layui-form-label">上级:</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone" id="debwuidewidewdewdew" value="${model.parent!'0'}" class="layui-input" disabled>
                </div>
            </div>
            <div class="layui-inline layui-col-md5">
                <label class="layui-form-label">双击选择:</label>
                <div class="layui-input-inline" >
                    <div id="jsTreeParentUnit"></div>
                </div>
            </div>
        </div>
        <div style="height: 50px;"></div>
        <div class="layui-form-item">
            <div class="layui-col-md6" style="text-align: center;">
                <div style="width: 40px;"></div>
                <button class="layui-btn" onclick="add_dwdwd()">更新</button>
                <button class="layui-btn layui-btn-danger" onclick="x_admin_close()">关闭</button>
            </div>
        </div>
    </form>
</div>
</body>
<script>

    $(function () {
        $("#jsTreeParentUnit").jstree({
            plugins: ["wholerow", "json_data"],
            core: {
                data: {
                    dataType: "json",
                    url: function (node) {
                        return node.id === "#" ? "/admin/function/tree?pid=0" : "/admin/function/tree?pid=" + node.id
                    }
                },
                multiple: false
            }
        }).on("dblclick.jstree", function (node) {
            selectParentMenu();
        });
    });


    function selectParentMenu() {
        var tree = $.jstree.reference("#jsTreeParentUnit");
        var node = tree.get_selected(true);
        $("#parentId").val(node[0].id);
        $("#debwuidewidewdewdew").val(node[0].text);
    }

    function add_dwdwd() {
        var data = $("#dwedwdefefefewfewdewdew").serialize();
        $.post("/admin/function/update",
            data,
            function (data) {
                layer.alert(data.msg, {icon: 6}, function () {
                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                });
            }, "json");
    }


</script>
</html>